import request from '@/utils/request'
// 获取用户列表
export const getUsers = params => request({
  url: 'users',
  method: 'GET',
  params
})
// 添加用户
export const setUser = data => request({
  url: 'users',
  method: 'POST',
  data
})
// 修改用户状态
export const putUserState = (id, type) => request({
  url: `users/${id}/state/${type}`,
  method: 'PUT'
})
// 删除用户
export const deleteUser = (id) => request({
  url: `users/${id}`,
  method: 'delete'
})
// 获取用户信息
export const getUserInfo = (id) => request({
  url: `users/${id}`,
  method: 'GET'
// 修改用户信息
})
export const putUserInfo = (id, email, mobile) => request({
  url: `users/${id}`,
  method: 'PUT',
  data: {
    email,
    mobile
  }
})
// 获取用户信息
export const getRolesInfo = () => request({
  url: 'roles',
  method: 'GET'
})
// 获取用户信息
export const putRolesInfo = (id, rid) => request({
  url: `users/${id}/role`,
  method: 'PUT',
  data: {
    rid
  }
})
